<?php

namespace slinks\common\io;

use slinks\common\Finder\Finder;

/**
 * Reads all classes from a given Finder. 
 * @author navid
 *
 */
class ClassReader {
    /* @var $fileSystemReader FileSystemReader */

    private $fileSystemReader = null;

    public function __construct(IClassVisitor $classVisitor) {
        $this->fileSystemReader = new FileSystemReader(new ClassFileSystemVisitor($classVisitor));
    }

    /**
     * Reads all Classes and Interfaces from the filesystem begining at the given directory.
     * @param Finder $finder the Finder configured to read the files you want visited.
     * 				 Directories will never be visited since they cannot contain class declarations.
     *
     */
    public function read(Finder $finder) {
        $this->fileSystemReader->read($finder);
    }

}

